#include "Programme.h"

Programme::Programme(){
	p_id = "";
	p_name = "";
	s_id = NULL;
	credit_req = 0;
}
Programme::Programme(string i_p_id, string i_p_name, string* i_s_id, int i_credit_req){
	p_id = i_p_id;
	p_name = i_p_name;
	s_id = i_s_id;
	credit_req = i_credit_req;
}

void Programme::Set_p_id(string i_p_id){
	p_id = i_p_id;
}
void Programme::Set_p_name(string i_p_name){
	p_name = i_p_name;
}
void Programme::Set_subject_list(string* i_s_id){
	s_id = i_s_id;
}
void Programme::Set_requiement(int i_credit_req){
	credit_req = i_credit_req;
}

string Programme::Get_p_id(){
	return p_id;
}
string Programme::Get_p_name(){
	return p_name;
}

void Programme::Get_elec_subject(Subject* inp, int &numInp, Subject* out, int &numOut){
	int i = 0, j = 0, count = 0;
	for(i; i<numInp; i++)
	{
		for(j; j<60; j++){
			if(strcmp(s_elec_id[j].c_str(), inp[i].get_id().c_str())){
				out[count] = inp[i];
				count++;
			}
		}
	}
}

void Programme::Get_comp_subject(Subject* inp, int &numInp, Subject* out, int &numOut){
	int i = 0, j = 0, count = 0;
	for(i; i<numInp; i++)
	{
		for(j; j<60; j++){
			if(strcmp(s_comp_id[j].c_str(), inp[i].get_id().c_str())){
				out[count] = inp[i];
				count++;
			}
		}
	}
}
int Programme::Get_requiement(){
	return credit_req;
}